<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>万虎CMS后台管理</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="__ADMINLTE__bootstrap/css/bootstrap.min.css">

<link rel="stylesheet" href="__ADMINLTE__bootstrap/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="__ADMINLTE__bootstrap/ionicons/css/ionicons.min.css">
<script type="text/javascript" src="__PLUGINS__/webuploader/jquery-1.10.2.min.js"></script>

<!-- Font Awesome 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    -->
<!-- Ionicons
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    --> 
<!-- Theme style -->
<link rel="stylesheet" href="__ADMINLTE__dist/css/AdminLTE.min.css">
<link rel="stylesheet" href="__ADMINLTE__dist/css/skins/skin-blue.min.css">
<link rel="stylesheet" type="text/css" href="__PLUGINS__webuploader/webuploader.css">
<!-- test -->
<script src="__ADMINLTE__plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script src="__ADMINLTE__plugins/select2/select2.full.min.js"></script>
<link rel="stylesheet" href="__ADMINLTE__plugins/select2/select2.min.css">
<!-- test end -->
<script type="text/javascript" charset="utf-8" src="__PLUGINS__ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PLUGINS__ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PLUGINS__ueditor/lang/zh-cn/zh-cn.js"></script>
<!-- chartjs -->
<script type="text/javascript" charset="utf-8" src="__PLUGINS__chartjs/js/Chart.min.js"></script>
<!-- chartjs END-->
<!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->



<style type="text/css">
.pagea{
    float: right;
}
.pagea .current{
    background:#337ab7;
    border: 1px solid #ddd;
    color: #fff;
    float: left;
    line-height: 1.42857;
    margin-left: -1px;
    padding: 6px 12px;
    position: relative;
    text-decoration: none;
}
.pagea a{
    background:#fafafa;
    border: 1px solid #ddd;
    color: #666;
    float: left;
    line-height: 1.42857;
    margin-left: -1px;
    padding: 6px 12px;
    position: relative;
    text-decoration: none;
}
.listorder{
    border: 1px solid #D0D0D0;
    height: 28px;
    margin: 0 5px 0 0;
    padding: 2px 0 2px 5px;
    border: 1px solid #d0d0d0;
    background: url("public/images/input.png") repeat-x scroll 0 0 #FFFFFF;
    font-size: 12px;
    border-radius: 3px;
}
.alink {
    color:#444;
}
</style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

    <!-- Main Header -->
    <header class="main-header">

        <!-- Logo -->
        <a href="<?php echo U('Index/index'); ?>" class="logo">
            <span class="logo-mini"><b>W</b>MS</span>
            <span class="logo-lg"><b>Wanhu</b>CMS</span>
        </a>

        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
            </a>
            <!-- Navbar Right Menu -->
            <div class="navbar-custom-menu">

                <ul class="nav navbar-nav">

                    <li class="dropdown user user-menu">
                    <a href="<?php echo U('index/Index/index'); ?>" target="_blank">
                        <span class="hidden-xs">访问网站首页</span>
                    </a>
                    </li>
                    <!-- User Account Menu -->
                    <li class="dropdown user user-menu">
                    <?php
                    $user_info = M('user')->where('id='.session('id'))->find();
                    ?>
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <!-- <img src="__ADMINLTE__dist/img/user2-160x160.jpg" class="user-image" alt="User Image"> -->
                        <span class="hidden-xs"><?php echo $user_info['username']; ?></span>
                        <span class="hidden-xs"><?php echo $user_info['rolesin']; ?></span>
                    </a>

                    <ul class="dropdown-menu">
                        <li class="user-header">
                        <img src="__ADMINLTE__dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
                        <p>
                        Alexander Pierce - Web Developer
                        <small>Member since Nov. 2012</small>
                        </p>
                        </li>
                        <!-- Menu Footer-->
                        <li class="user-footer">
                        <div class="pull-left">
                            <a href="<?php echo U('User/edit',array('id'=>session('id'))); ?>" class="btn btn-default btn-flat">修改密码</a>
                        </div>
                        <div class="pull-right">
                            <a href="<?php echo U('Sign/out'); ?>" class="btn btn-default btn-flat">退出</a>
                        </div>
                        </li>
                    </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <aside class="main-sidebar">
        <section class="sidebar">
            <ul class="sidebar-menu">

                <li class="header"><a href="<?php echo U('Index/index'); ?>"><i class="fa fa-home"></i>系统首页</a></li>  

                <li class="<?php if(isset($active['contentAdd'])): ?>active<?php endif; ?>"><a href="<?php echo U('Content/addSliderContent'); ?>"><i class="fa fa-edit"></i><span>内容发布</span> </a></li>
                <li class="<?php if(isset($active['content'])): ?>active<?php endif; ?>"><a href="<?php echo U('Content/listindex'); ?>"><i class="fa fa-align-right"></i><span>内容管理</span> </a></li>
                <li class="<?php if(isset($active['term'])): ?>active<?php endif; ?>"><a href="<?php echo U('Term/index'); ?>"><i class="fa fa-list"></i><span>栏目管理</span></a></li>
                <li class="<?php if(isset($active['termAdd'])): ?>active<?php endif; ?>"><a href="<?php echo U('Term/addTerm'); ?>"><i class="fa fa-plus-square"></i><span>添加栏目</span></a></li> 

                <li class="treeview <?php if(isset($active['seo'])): ?>active<?php endif; ?>">
                <a href="<?php echo U('Term/index'); ?>"><i class="fa fa-line-chart"></i><span>营销</span> <i class="fa fa-angle-left pull-right"></i></a>
                <ul class="treeview-menu">
                    <li class="<?php if(isset($active['seo']['seoset'])): ?>active<?php endif; ?>"><a href="<?php echo U('Seoset/index'); ?>">SEO</a></li>
                    <li class="<?php if(isset($active['set']['online'])): ?>active<?php endif; ?>"><a href="<?php echo U('Online/index'); ?>">客服</a></li>
                </ul>
                </li>

                <?php if((APP_DEVEL)): ?>
                <li class="treeview <?php if(isset($active['model'])): ?>active<?php endif; ?>">
                <a href="<?php echo U('Term/index'); ?>"><i class="fa fa-table"></i><span>模型管理</span> <i class="fa fa-angle-left pull-right"></i></a>
                <ul class="treeview-menu">
                    <li class="<?php if(isset($active['model']['add'])): ?>active<?php endif; ?>"><a href="<?php echo U('TermModel/add'); ?>">添加模型</a></li>
                    <li class="<?php if(isset($active['model']['index'])): ?>active<?php endif; ?>"><a href="<?php echo U('TermModel/index'); ?>">模型管理</a></li>
                </ul>
                </li>
                <?php endif; ?>
                <li class="treeview <?php if(isset($active['function'])): ?>active<?php endif; ?>">
                <a href="#"><i class="fa fa-th-large"></i><span>功能模块</span> <i class="fa fa-angle-left pull-right"></i></a>
                <ul class="treeview-menu">
                    <li class="<?php if(isset($active['function']['links'])): ?>active<?php endif; ?>"><a href="<?php echo U('Links/index'); ?>">链接列表</a></li>
                    <li class="<?php if(isset($active['function']['message'])): ?>active<?php endif; ?>"><a href="<?php echo U('Message/index'); ?>">留言管理</a></li>
                </ul>
                </li>

                <li class="treeview <?php if(isset($active['extend'])): ?>active<?php endif; ?>">
                <a href="#"><i class="fa fa-th-list"></i><span>扩展功能</span> <i class="fa fa-angle-left pull-right"></i></a>
                <ul class="treeview-menu">
                    <li class="<?php if(isset($active['extend']['getDb'])): ?>active<?php endif; ?>"><a href="<?php echo U('GetDb/index',array('method'=>'index')); ?>">数据库备份</a></li>
                    <li class="<?php if(isset($active['extend']['log'])): ?>active<?php endif; ?>"><a href="<?php echo U('User/manage_log'); ?>">后台操作日志</a></li>  
                    <!-- <li><a href="<?php echo U('Index/jpgaph'); ?>">统计图</a></li>  -->
                </ul>
                </li>

                <li class="<?php if(isset($active['safe'])): ?>active<?php endif; ?>"><a href="<?php echo U('System/safe'); ?>"><i class="fa fa-area-chart"></i><span>安全与效率</span></a></li>

                <li class="treeview <?php if(isset($active['system'])): ?>active<?php endif; ?>">
                <a href="#"><i class="fa fa-gear"></i><span>系统设置</span> <i class="fa fa-angle-left pull-right"></i></a>
                <ul class="treeview-menu">

                    <li class="<?php if(isset($active['system']['option'])): ?>active<?php endif; ?>"> <a href="<?php echo U('Option/index'); ?>"><span>网站设置</span></a></li>
                    <li class="<?php if(isset($active['system']['user'])): ?>active<?php endif; ?>"><a href="<?php echo U('User/index'); ?>">管理员设置</a></li>
                    <li class="<?php if(isset($active['system']['upload'])): ?>active<?php endif; ?>"><a href="<?php echo U('System/index'); ?>">检测更新</a></li>
                    <li class="<?php if(isset($active['system']['cache'])): ?>active<?php endif; ?>"><a href="<?php echo U('System/clear_cache'); ?>">清除缓存</a></li>
                    <li class="<?php if(isset($active['system']['sitemap'])): ?>active<?php endif; ?>"><a href="<?php echo U('System/createSitemap'); ?>">生成sitemap</a></li>
                </ul>
                </li>
            </ul>
        </section>
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        
       <section class="content-header">
<h1>
           内容编辑
<small>Optional description</small>
</h1>
<ol class="breadcrumb">
	<li><a href="<?php echo U('Index/index'); ?>"><i class="fa fa-dashboard"></i>首页</a></li>
	<li class="active"> 内容编辑</li>
</ol>
</section>
<form action="<?php echo U('Content/editContent', ['id'=>$edit_info['id']]); ?>" method="post">
	<input type="hidden" name="id" value="<?php echo $edit_info['id']; ?>">
	<input type="hidden" name="cover_img" id="imgs" value="">
	<input type="hidden" name="status" value="0">
	<input type="hidden" name="rec_ok" value="0">
	<input type="hidden" name="top_ok" value="0">
	<section class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box">
			
				<!--输入框 -->
				<div class="box-body pad" style="padding:10px 20px;">
                    所属栏目：
                    <select name="term_id" id="term_id" class="form-control">
                        <option value="0">不修改栏目</option>
                        <?php if(is_array($all_term)): $i = 0; $__LIST__ = $all_term;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?>
                        <option value="<?php echo $data['id']; ?>" <?php if(($data['id'] == $edit_info['term_id'])): ?>selected<?php endif; ?>><?php echo $data['name']; ?></option>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
				</div>
                <br />
					
				<div class="box-body pad" style="padding:10px 20px;">
                    标题：
					<input class="form-control" name="title" value="<?php echo $edit_info['name']; ?>" placeholder="标题">
				</div>
                <br />
                <?php if($termModel['type']==0){ ?>
				<div class="box-body pad" style="padding:10px 20px;">
				关键词：
					<input class="form-control" name="keywords" value="<?php echo $edit_info['keywords']; ?>" placeholder="关键词">
				</div>
                <?php }; ?>
				<div class="box-body pad" style="padding:10px 20px 0px 20px;">
				摘要：
					<textarea class="form-control" id="des" rows="4" name="description" placeholder="摘要描述(150字以内)"><?php echo $edit_info['description']; ?></textarea>
				</div>
				<!--输入框 END-->
				
				<!-- editor -->
				<div class="box-body pad">
					<textarea id="editor" class="ueditor textarea" name="content" placeholder=""
					style="width: 100%;height:300px;font-size: 14px; line-height: 18px;padding: 10px;"><?php echo $edit_info['content']; ?></textarea>
                <script> $(function(){ UE.getEditor("editor"); });</script>
				</div>
				<!-- editor end -->
				
				
                <?php if($termModel['type']==0){ ?>
				
				<div style="padding:8px 0px 0px 21px;">
					<input type="checkbox" class="dese" <?php if(($edit_info['intercept'] == 1)): ?>checked="checked"<?php endif; ?> value="1" name="intercept"> 是否截取内容 
					<input type="text" size="3"  value="150" style="vertical-align: middle;line-height: 20px;"  class="fontsize">字符至内容摘要 
				</div>
				<!-- 于此相关的class id 等勿动 -->
				<script>
					$(document).ready(function(){
					  $(".dese").click(function(){
					    
								if($('.dese').is(':checked')) {
								var TEST = UE.getEditor('editor').getContentTxt();
								var SIZE = $(".fontsize").val();
								$("#des").val(TEST.substr(0,SIZE));
								}else{
								$("#des").val('');
								}
						
					    });
						
					});
				</script>
				<!-- 勿动 -->
				
	            	<!-- 推荐 显示 置顶-->
		<div class="box-body pad" style="padding:10px 20px;">
		发表时间：
			<input class="form-control" name="create_time" value="<?php echo date('Y-m-d H:i:s',$edit_info['create_time']); ?>" placeholder="发表时间">
		</div> 

		<!-- <?php echo date('Y-m-d H:i:s',$edit_info['create_time']); echo date("Y-m-d H:i:s",time()); ?>-->
				<div style="padding:10px 20px;">
					<input type="checkbox" name="status" <?php if($edit_info['status'] == 1): ?>checked="checked"<?php endif; ?> value="1"> 前台显示 &nbsp;&nbsp;
					<input type="checkbox" name="rec_ok" <?php if($edit_info['rec_ok'] == 1): ?>checked="checked"<?php endif; ?> value="1"> 推荐 &nbsp;&nbsp;
					<input type="checkbox" name="top_ok" <?php if($edit_info['top_ok'] == 1): ?>checked="checked"<?php endif; ?> value="1"> 置顶
				</div>			
					<!-- 推荐 显示 置顶 END-->
				
                <div id="uploader" class="wu-example-one" name="cover_img">
                            <!--用来存放文件信息-->
                            <div id="thelist2" class="uploader-list">
                                <?php if(!empty($edit_info['cover_img'])){ ?>
                                <div class="item">
                                    <input type="hidden" name="cover_img" value="<?php echo $edit_info['cover_img']; ?>" />
                                    <image style="max-width:300px;max-height:200px" src="__UPLOADS__<?php echo $edit_info['cover_img']; ?>" />
                                    <a class="remove-img"><i class="fa fa-remove"></i>删除图片</a>
                                </div>
                                <?php }; ?>
                            </div>
                            <div class="btns" style="padding:10px 20px;">
                                <div class="picker" id="picker2">图片上传</div>
                            </div>
                </div>
                <?php }else{ ?>
				<div style="padding:10px 20px;">
					<input type="checkbox" name="status" <?php if($edit_info['status'] == 1): ?>checked="checked"<?php endif; ?> value="1"> 通过审核 &nbsp;&nbsp;
				</div>			
                <?php }; ?>

			</div>
			
			<div class="box">
            <?php foreach($formList as $name => $form): ?>
				<div class="box-body pad" style="padding:10px 20px;">
                    <?php echo $name; ?>：
                                <?php echo $form; ?>
				</div>
            <?php endforeach; ?>
			</div>
            
                <?php if($termModel['type']==0){ ?>
			                                 <!-- SEO -->
					<div class="box-header with-border" style="margin:0 18px;padding-left:0;">
						<h3 class="box-title" >SEO设置:</h3>
					</div>
						<div class="highlight">
				    	<dl>
				    		<dt class="adt">
				    			<em class="required"></em>标题:</dt>
				    		<dd class="ftype_input">
				    			<div class="fbox">
				    			   <input class="form-control" name="seo_title" value="<?php echo $edit_info['seo_title']; ?>" placeholder="META Title（标题）">
				    				
				    			</div>
				    		</dd>
				    	</dl>
				    </div>
					
					<div class="highlight">
				    	<dl>
				    		<dt class="adt">
				    			<em class="required"></em>关键词:</dt>
				    		<dd class="ftype_input">
				    			<div class="fbox">
				    			  <input class="form-control" name="seo_keywords" value="<?php echo $edit_info['seo_keywords']; ?>" placeholder="META Keywords（关键词）">
				    			</div>
				    		</dd>
				    	</dl>
				    </div>
							
							<div class="highlight">
				    	<dl>
				    		<dt class="adt">
				    			<em class="required"></em>摘要:</dt>
				    		<dd class="ftype_input">
				    			<div class="fbox">
				    			<textarea class="form-control" rows="14" name="seo_description" style="width:100%;height:130px;" placeholder="摘要描述"><?php echo $edit_info['seo_description']; ?></textarea>
				    			</div>
				    		</dd>
				    	</dl>
				    </div>
					<!-- SEO END-->
                <?php }; ?>
		</div>
		
	</div>


	</section>
	<div style="padding:10px 20px;"><input type="submit" class="btn btn-block btn-primary" style="width:100px; border:none;" value="提交"/></div>
	<div style="clear:both">
	</div>
	<!-- 姑且如此 -->
	<script language="javascript" type="text/javascript">
								$(document).ready(function(){
									 <!-- 二级栏目-->
									 $("#parent_one").change(function(){
									 var checkValueTwo=$("#parent_one").val();
									 var checkValueTwo_model=$("#parent_one :selected").data('model');
	                                 $("#term_id").val(checkValueTwo);
	                                 $("#model_id").val(checkValueTwo_model);
									  	$.ajax({  
											  type:"post",  
											  url:"<?php echo U('Content/ajaxSelectTwo'); ?>",  
											  dataType:'json',
											  data:{ 
												  Two:checkValueTwo, 
												},  
												success:
												  function(data){
												  
												  if(data != ""){
													$("#ajaxlistTwo").html('');
												    str ='<select class="form-control" id="parent_two" style="float:left;margin-right:10px;"><option value="">选择栏目</option>';
													for(var i=0;i<data.length;i++){
													str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
													 }
													str = str+'</select>';
													$("#ajaxlistTwo").html(str);
													
													//再调用
			<!-- 三级栏目-->
			 $("#parent_two").change(function(){
			 var checkValueThree=$("#parent_two").val();
			  $("#term_id").val(checkValueThree);
					$.ajax({  
					  type:"post",  
					  url:"<?php echo U('Content/ajaxSelectThree'); ?>",  
					  dataType:'json',
					  data:{ 
						  Three:checkValueThree, 
						},  
						success:
						  function(data){
						  
						  if(data != ""){
							$("#ajaxlistThree").html('');
							str ='<select class="form-control" id="parent_three" style="float:left;margin-right:10px;"><option value="">选择栏目</option>';
							for(var i=0;i<data.length;i++){
							str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
							 }
							str = str+'</select>';
							$("#ajaxlistThree").html(str);
							//再调用
																	<!-- 四级栏目-->
																	 $("#parent_three").change(function(){
																	 var checkValueFour=$("#parent_three").val();
																	  $("#term_id").val(checkValueFour);
																			$.ajax({  
																			  type:"post",  
																			  url:"<?php echo U('Content/ajaxSelectFour'); ?>",  
																			  dataType:'json',
																			  data:{ 
																				  Four:checkValueFour, 
																				},  
																				success:
																				  function(data){
																				  
																				  if(data != ""){
																					$("#ajaxlistFour").html('');
																					str ='<select class="form-control" id="parent_Four" style="float:left;margin-right:10px;"><option value="">选择栏目</option>';
																					for(var i=0;i<data.length;i++){
																					str +='<option value="'+data[i].id+'">'+data[i].name+'</option>';
																					 }
																					str = str+'</select>';
																					$("#ajaxlistFour").html(str);
																					//再调用
                                                                    $("#parent_Four").change(function(){
																	 var checkValuefive=$("#parent_Four").val();
																	  $("#term_id").val(checkValuefive);
														
																	 })
																					//再调用 END
																					
																					}else{
																					$("#ajaxlistFour").html('');
																					}
																					
																					},
																				 });
																	 })
																	<!-- 四级栏目 END--> 
							//再调用 END
							
							}else{
							$("#ajaxlistThree").html('');
							}
							
							},
						 });
			 })
			<!-- 三级栏目 END--> 
													  //再调用 END
													
													}else{
													$("#ajaxlistTwo").html('');
													}
													
													},
												 });
									 })
									<!-- 二级栏目 END-->  	
								});
							</script> 
</form>
 
    </div>
    <!-- /.content-wrapper -->
    <!-- Main Footer -->
    <footer class="main-footer">
        <!-- To the right -->
        <div class="pull-right hidden-xs">
            WanhuCMS，让世界更了解你
        </div>
        <!-- Default to the left -->
        <strong>Copyright &copy; 2016 <a href="http://www.wanhunet.com" class="alink">Wanhunet</a>.All rights reserved.</strong> 
    </footer>

    <div class="control-sidebar-bg"></div>
</div>
<script src="__ADMINLTE__plugins/jQuery/jQuery-2.1.4.min.js"></script>
<script src="__ADMINLTE__plugins/select2/select2.full.min.js"></script>
<script src="__ADMINLTE__bootstrap/js/bootstrap.min.js"></script>
<script src="__ADMINLTE__dist/js/app.min.js"></script>
<script type="text/javascript" src="__PLUGINS__webuploader/webuploader.html5only.min.js"></script>
<script type="text/javascript" src="__PLUGINS__webuploader/webuploader.main.js"></script>
<script>
$(function() {
        $('.wu-example-one').createUpload('one', '<?php echo U('AjaxUploads/img'); ?>');
        $('.wu-example').createUpload('list', '<?php echo U('AjaxUploads/img'); ?>');
        $('.wu-example-file').createUpload('file', '<?php echo U('AjaxUploads/file'); ?>');
        });
</script>



</body>
</html>
